package com.sgroupware.modules.leave.dao;

import com.simpleframe.persistence.hibernate.Finder;
import com.simpleframe.persistence.hibernate.HibernateGenericDao;
import com.simpleframe.persistence.hibernate.OrderBy;
import com.simpleframe.persistence.hibernate.Page;
import com.simpleframe.persistence.hibernate.Searcher;
import com.simpleframe.persistence.hibernate.Searchers;
import com.sgroupware.modules.leave.Leave;

public class LeaveDAO extends HibernateGenericDao<Leave, Long>{
	
	public Page getPage(Searcher searcher){
		Finder finder = searcher.createFinder(Leave.class);
		finder.addOrder(OrderBy.desc("id"));
		
		Searchers searchers = finder.createSearchers(searcher);
		searchers.andLike("name");
		searchers.andEq("state");
		searchers.andStartEndDate("insertTime");
		
		return findPageByFinder(finder);
	}
}